;; This code depends on call-process passing back the subprocess exit
;; status. Thus, you need Emacs 18.58 or later to run it. For the
;; vc-directory command to work properly as documented, you need 19.
+;; You also need Emacs 19's ring.el.
;;
;; The vc code maintains some internal state in order to reduce expensive
;; version-control operations to a minimum. Some names are only computed
(let ((name-and-type (vc-registered file)))
(and name-and-type (car name-and-type))))))
+(defun vc-registration-error (file)
+ (if file
+ (error "File %s is not under version control." file)
+ (error "Buffer %s is not associated with a file." (buffer-name))))
+
(defvar vc-binary-assoc nil)
(defun vc-find-binary (name)
;; iff that buffer is a compilation output buffer
;; that contains markers into the current buffer.
(save-excursion
- (mapcar (lambda (buffer)
+ (mapcar (function
+ (lambda (buffer)
(set-buffer buffer)
(let ((errors (or
compilation-old-error-list
(cdr (car errors))))
(setq buffer-error-marked-p t))
(setq errors (cdr errors)))
- (if buffer-error-marked-p buffer)))
+ (if buffer-error-marked-p buffer))))
(buffer-list)))))))
;; the actual revisit
(pop-to-buffer vc-parent-buffer))
(if buffer-file-name
(vc-next-action-on-file buffer-file-name verbose)
- (error "There is no file associated with buffer %s" (buffer-name)))))
+ (vc-registration-error nil))))
;;; These functions help the vc-next-action entry point
(error "There is no version-control master associated with this buffer."))
(let ((file buffer-file-name)
unchanged)
+ (or (and file (vc-name file))
+ (vc-registration-error file))
(vc-buffer-sync)
(setq unchanged (vc-workfile-unchanged-p buffer-file-name))
(if unchanged
(setq buffer-read-only nil)
(forward-line 1) ;; Skip header line
(mapcar
- (lambda (x)
+ (function
+ (lambda (x)
(forward-char 2) ;; skip dired's mark area
(vc-dired-reformat-line x)
- (forward-line 1)) ;; go to next line
+ (forward-line 1))) ;; go to next line
(nreverse userlist))
(setq buffer-read-only t)
(goto-char (point-min))
(or (boundp 'minor-mode-map-alist)
(fset 'vc-directory 'vc-directory-18))
+; Emacs 18 also lacks these.
+(or (boundp 'compilation-old-error-list)
+ (setq compilation-old-error-list nil))
+
;; Named-configuration support for SCCS
(defun vc-add-triple (name file rev)
(vc-shrink-to-fit)
(goto-char (point-min))
)
- (error "There is no version-control master associated with this buffer")
+ (vc-registration-error buffer-file-name)
)
)
(setq newvers (vc-lookup-triple file newvers)))
(apply 'vc-do-command 1
(or (vc-backend-dispatch file "vcdiff" "rcsdiff")
- (error "File %s is not under version control." file))
+ (vc-registration-error file))
file
(and oldvers (concat "-r" oldvers))
(and newvers (concat "-r" newvers))